project(owl-eye)

cmake_minimum_required(VERSION 2.8)

option(BUILD_SHARED
  "On to build shared libraries, off for static libraries."
  OFF)

option(BUILD_DEBUG
  "On to build release version, off for debug version."
  ON)

if (BUILD_SHARED)
  add_definitions(-DBUILD_SHARED)
  set(LIB_TYPE SHARED)
else ()
  set(LIB_TYPE STATIC)
endif (BUILD_SHARED)

# there should be no comma between the name and value
set(LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
set(BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
set(WORK_DIR ${PROJECT_SOURCE_DIR}/..)

if (WIN32)
  set(MAGIC_DIR D:)
else ()
  set(MAGIC_DIR /media/D)
endif (WIN32)

include_directories(${WORK_DIR}/axle/trunk/include 
                    ./include)

link_directories(${WORK_DIR}/axle/trunk/lib)

if (BUILD_DEBUG)
  set(CMAKE_BUILD_TYPE "Debug")
else ()
  set(CMAKE_BUILD_TYPE "Release")
endif (BUILD_DEBUG)

if (MSVC)
  foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES})
    message(STATUS "OUTPUT_CONFIG=${OUTPUT_CONFIG}")
    string(TOUPPER ${OUTPUT_CONFIG} OUTPUT_CONFIG)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} ${LIB_DIR})
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} ${LIB_DIR})
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} ${BIN_DIR})
  endforeach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES})
else ()
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR})
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB_DIR})
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN_DIR})
endif (MSVC)

add_subdirectory(src)
add_subdirectory(test)

message(STATUS "BIN_DIR=${BIN_DIR}")
message(STATUS "LIB_DIR=${LIB_DIR}")
message(STATUS "WORK_DIR=${WORK_DIR}")
message(STATUS "LIB_TYPE = ${LIB_TYPE}")
message(STATUS "MAGIC_DIR = ${MAGIC_DIR}")
